package com.xxd.rpt3.Entity;

import org.hibernate.annotations.ColumnDefault;
import org.hibernate.annotations.UpdateTimestamp;
import org.springframework.data.annotation.LastModifiedDate;

import javax.persistence.*;
import java.io.Serializable;
import java.sql.Timestamp;
import java.util.Date;

/**
 * @Author XuXd
 * @Description: token 历史
 * @CreateDate: 14:03 2019-09-11
 * @Modified by: *
 */
@Entity
@Table(name = "rpt2_token", indexes = { @Index(columnList = "code") })
public class JwtTokenHis implements Serializable {

	@Id
	@GeneratedValue
	long id;
	@Column(unique = true, length = 50)
	String key;
	@Column(length = 500)
	String value;
	@Column(name = "code")
	String userCode;// 主要用于快速索引用户token
	String salt;
	@UpdateTimestamp
	@Temporal(TemporalType.TIMESTAMP)
	Date freshDate;
	//0表示刷新token，-1表示刷新且永久有效token，其它数字标识不刷新，但会删除
	@Column(name = "keep")
	@ColumnDefault(value = "0")
	int keepDay;

	public int getKeepDay() {
		return keepDay;
	}

	public void setKeepDay(int keepDay) {
		this.keepDay = keepDay;
	}

	public Date getFreshDate() {
		return freshDate;
	}
	public void setFreshDate(Date freshDate) {
		this.freshDate = freshDate;
	}
	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public String getSalt() {
		return salt;
	}

	public void setSalt(String salt) {
		this.salt = salt;
	}

	public String getUserCode() {
		return userCode;
	}

	public void setUserCode(String userCode) {
		this.userCode = userCode;
	}

	public String getKey() {
		return key;
	}

	public void setKey(String key) {
		this.key = key;
	}

	public String getValue() {
		return value;
	}

	public void setValue(String value) {
		this.value = value;
	}

}
